<?php
	class ModelSettingSetting extends Model {
		public function getDefaultLabel($user_id) {
			$query = $this->db->query("SELECT * FROM setting WHERE user_id = '".$this->db->escape($user_id)."'");//
			return $query->row;//
		}
		public function editDefaultLabel($data) {
			$label = $this->getDefaultLabel($this->db->escape($data['user_id']));
			if(!empty($label)){
				$sql = "UPDATE setting  SET defaultlabel = '".$this->db->escape($data['label'])."' WHERE user_id ='".$this->db->escape($data['user_id'])."'";
			}else{
				$sql = "INSERT INTO setting  SET defaultlabel = '".$this->db->escape($data['label'])."' , user_id ='".$this->db->escape($data['user_id'])."'";
			}
			$query = $this->db->query($sql);
			return $this->db->countAffected();//$sql;//$label;//
		}
	}